#!/usr/bin/ksh

rcs=$1
if [[ ! -d $rcs ]]
then
	print -u2 "Error: Direectory '$rcs' does not exist or is not a directory."
	exit 1
fi

egrep -l "^PROXY_PROMOTE" $rcs/*/.meta/conf | while read dir
do
	ndir="$(print $dir| sed 's!/.meta/conf!!')"
	echo su - sasadmin -c \"/sas/rcs/utils/promoter $(basename $ndir) \>/dev/null 2\>\&1\" 
done
exit 0

